package be.jaisy.project.adapter.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.UniqueConstraint;
import javax.persistence.Version;

@Entity
@Table(name = "JAISY_Project", uniqueConstraints = {@UniqueConstraint(columnNames={"NAME"})})
@TableGenerator(name = "PROJECT_GEN", table = "PROJECT_GENERATOR_TABLE", pkColumnName = "key", valueColumnName = "hi", pkColumnValue = "EMP", allocationSize = 20)
public class Project implements Serializable {

	private static final long serialVersionUID = -7681005006524596416L;

	private Long id;

	private Long version;

	private String name;

	private String description;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator="PROJECT_GEN")	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Version
	@Column(name = "VERSION")
	public Long getVersion() {
		return version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}

	@Column(name = "NAME", unique = true, nullable = false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "DESCRIPTION")
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
}
